﻿@model Zatify.WebUI.Admin.Models.PaymentInfoViewModel
@{
    ViewBag.Title = "Business Payment Info";
    Layout = "~/Areas/Admin/Views/Shared/_AdminLayout.cshtml";
}
@section Styles
{
    <style type="text/css">
        .ui-datepicker-calendar
        {
            display: none;
        }
        button.ui-datepicker-current
        {
            display: none;
        }
    </style>
}
@section Scripts
{
    <script src="@Url.Content("~/Scripts/jquery-ui-1.9.2.min.js")" type="text/javascript"></script>
    <script type="text/javascript">

        $(document).ready(function () {

            $('#CreditCardExpDate').datepicker({
                minDate: new Date(2013, 1 - 1, 1),
                maxDate: "+40y",
                changeMonth: true,
                changeYear: true,
                showButtonPanel: true,
                dateFormat: 'MM yy',
                onClose: function (dateText, inst) {
                    var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
                    var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
                    $(this).datepicker('setDate', new Date(year, month, 1));
                }
            });

            $('#BillingUse').change(function () {

                setBillingAddress($(this).attr("checked"));
            });

            $('#CreditCardPin').val(@Model.CreditCardPin);

            @if (Model.CreditCardExpDate <= DateTime.MinValue)
            {
            
                <text>$('#CreditCardExpDate').val('');</text>
            }
        });

        function setBillingAddress(isBillingAddress) {

            var billingAddress1 = $('#BillingAddress1');
            var billingAddress2 = $('#BillingAddress2');
            var billingCity = $('#BillingCity');
            var billingStateCode = $('#BillingStateCode');
            var billingZipCode = $('#BillingZipCode');

            if (isBillingAddress) {

                billingAddress1.attr('readonly', 'readonly');
                billingAddress2.attr('readonly', 'readonly');
                billingCity.attr('readonly', 'readonly');
                billingStateCode.attr('disabled', 'disabled');
                billingZipCode.attr('readonly', 'readonly');

                billingAddress1.val($('#BusinessAddress1').val());
                billingAddress2.val($('#BusinessAddress2').val());
                billingCity.val($('#BusinessCity').val());
                billingStateCode.val($('#BusinessStateCode').val());
                billingZipCode.val($('#BusinessZipCode').val());
            }
            else {

                billingAddress1.removeAttr('readonly');
                billingAddress2.removeAttr('readonly');
                billingCity.removeAttr('readonly');
                billingStateCode.removeAttr('disabled');
                billingZipCode.removeAttr('readonly');

                billingAddress1.val('');
                billingAddress2.val('');
                billingCity.val('');
                billingStateCode.val('1');
                billingZipCode.val('');
            }
        }

    </script>
}
<!--start bradecums-->
<div class="bradecums_bar">
    Business Profile Screens <span>&raquo;</span> @Model.BusinessName <span>&raquo;</span>
    Payment Info</div>
<!--end bradecums-->
<!--start button-->
<div class="zatify_panel_btn2">
    @Html.Partial("Partials/BusinessDetailsTabsControl", new BusinessDetailsTabsViewModel() { BusinessId = @Model.BusinessId, BusinessSection = BusinessSection.PaymentInfo })
    <div class="clearfix">
    </div>
</div>
<!--end button-->
<!--start add new part-->
<div class="add_new_zatify_user" style="border-top: 1px solid #d9dfe4;">
    @using (Html.BeginForm("PaymentInfo", "Business"))
    {
        @Html.HiddenFor(m => m.BusinessId)
        <div class="business_profile_screens_form_border">
            <div class="z_cms_coloum" style="border-right: 1px solid #d9dfe4;">
                <label class="">
                    <img src="@Url.Content("~/areas/admin/content/zatify/images/visa1.gif")" alt="visa card" />
                </label>
                <br />
                <br />
                <label class="apps_label_text">
                    Credit Card #:</label>
                @Html.TextBoxFor(m => m.CreditCardNo, new { @class = "apps_inputbox" })
                @Html.ValidationMessageFor(m => m.CreditCardNo)
                <br />
                <label class="apps_label_text">
                    Exp. Date:</label>
                @*@Html.TextBoxFor(m => m.CreditCardExpDate, new { @class = "apps_inputbox", @readonly = "readonly" })*@
                @Html.TextBox("CreditCardExpDate", (Model.CreditCardExpDate.HasValue ? Model.CreditCardExpDate.Value.ToString("MMMM yyyy") : String.Empty), new { @class = "apps_inputbox", @readonly = "readonly" })
                <br />
                <label class="apps_label_text">
                    Name of Card:</label>
                @Html.TextBoxFor(m => m.CreditCardName, new { @class = "apps_inputbox" })
                @Html.ValidationMessageFor(m => m.CreditCardName, "*")
                <br />
                <label class="apps_label_text">
                    PIN/Secure Code:</label>
                @Html.PasswordFor(m => m.CreditCardPin, new { @class = "apps_inputbox" })
                @Html.ValidationMessageFor(m => m.CreditCardPin, "*")
            </div>
            <div class="z_cms_coloum">
                <div>
                    <label class="apps_label_text">
                        Billing Address:</label>
                    @Html.CheckBoxFor(m => m.BillingUse, new { @class = "business_hour_checkbox" })
                    <span class="business_hour_checkbox_text">Use Business Address</span>
                    <br />
                    <label class="apps_label_text">
                        Street Address:</label>
                    @Html.HiddenFor(m => m.BusinessAddress1)
                    @if (Model.BillingUse)
                    {
                        @Html.TextBoxFor(m => m.BillingAddress1, new { @class = "apps_inputbox", @readonly = "readonly" })
                    }
                    else
                    {
                        @Html.TextBoxFor(m => m.BillingAddress1, new { @class = "apps_inputbox" }) 
                    }
                    @Html.ValidationMessageFor(m => m.BillingAddress1, "*")
                    <br />
                    <label class="apps_label_text">
                        Street Address 2:</label>
                    @Html.HiddenFor(m => m.BusinessAddress2)
                    @if (Model.BillingUse)
                    {
                        @Html.TextBoxFor(m => m.BillingAddress2, new { @class = "apps_inputbox", @readonly = "readonly" })
                    }
                    else
                    {
                        @Html.TextBoxFor(m => m.BillingAddress2, new { @class = "apps_inputbox" })
                    }
                    @Html.ValidationMessageFor(m => m.BillingAddress2, "*")
                    <br />
                    <label class="apps_label_text">
                        City:</label>
                    @Html.HiddenFor(m => m.BusinessCity)
                    @if (Model.BillingUse)
                    {
                        @Html.TextBoxFor(m => m.BillingCity, new { @class = "apps_inputbox", @readonly = "readonly" })
                    }
                    else
                    {
                        @Html.TextBoxFor(m => m.BillingCity, new { @class = "apps_inputbox" })
                    }
                    @Html.ValidationMessageFor(m => m.BillingCity, "*")
                    <br />
                    <label class="apps_label_text">
                        State:</label>
                    @Html.HiddenFor(m => m.BusinessStateCode)
                    @if (Model.BillingUse)
                    {
                        @Html.DropDownListFor(m => m.BillingStateCode, (IEnumerable<SelectListItem>)ViewData["USStates"], new { @class = "apps_selectbox", disabled = "disabled" })
                    }
                    else
                    {
                        @Html.DropDownListFor(m => m.BillingStateCode, (IEnumerable<SelectListItem>)ViewData["USStates"], new { @class = "apps_selectbox" })
                    }
                    <br />
                    <label class="apps_label_text">
                        Zip:</label>
                    @Html.HiddenFor(m => m.BusinessZipCode)
                    @if (Model.BillingUse)
                    {
                        @Html.TextBoxFor(m => m.BillingZipCode, new { @class = "apps_inputbox", @readonly = "readonly" })
                    }
                    else
                    {
                        @Html.TextBoxFor(m => m.BillingZipCode, new { @class = "apps_inputbox" })
                    }
                    @Html.ValidationMessageFor(m => m.BillingZipCode)
                </div>
            </div>
        </div>
        <div class="clearfix">
        </div>
        <div class="zatify_panel_btn" style="margin-top: 10px;">
            <a href="@Url.Action("PaymentInfoBack", "Business", new { id = Model.BusinessId })" style="text-decoration: none;">
                <input name="" type="button" class="btn apps_btn apps_gray_btn" value="<<Back" /></a>
            <input name="" type="submit" class="btn apps_btn apps_gray_btn" value="Save" />
        </div>
    }
</div>
<div class="clearfix">
</div>
<!--end add new part-->
